# -*- coding: UTF-8 -*-
"""
@author: tgy
@file: 674_最长连续递增序列.py
@time: 2021/01/24
"""


def findLengthOfLCIS01(nums: [int]) -> int:
    ...
    if not nums:
        return 0
    nums_len = len(nums)
    if nums_len <= 1:
        return nums_len

    max_lcs = 0
    pre_len = 1
    for i in range(1, nums_len):
        ...
        if nums[i - 1] < nums[i]:
            pre_len += 1
        else:
            max_lcs = max(max_lcs, pre_len)
            pre_len = 1
    max_lcs = max(max_lcs, pre_len)
    return max_lcs


def findLengthOfLCIS(nums: [int]) -> int:
    ...
    if not nums:
        return 0
    nums_len = len(nums)
    if nums_len <= 1:
        return nums_len
    max_lcs = 0
    begain = 0
    for i in range(1, nums_len):
        ...
        if nums[i - 1] >= nums[i]:
            max_lcs = max(max_lcs, i - begain)
            begain = i
    max_lcs = max(max_lcs,nums_len - begain)
    return max_lcs


if __name__ == '__main__':
    pass
    print(findLengthOfLCIS([1,2,3,2,5]))